/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufrgs.inf.prav.interop.jsf.components;

import java.io.IOException;
import java.util.Map;
import java.util.Set;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.FacesEvent;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Fernando
 */
public class DivComponent extends PravBaseComponent {

    public static final String COMPONENT_FAMILY = "PRAV_DIV";
    public static final String COMPONENT_TYPE = "PRAV_DIV";

    private String align;

    public DivComponent(){
        
    }

    @Override
    public void encodeBegin(FacesContext context) throws IOException {
        if (!displayPlataform()){
            hideInnerComponents();
            return;
        }

		ResponseWriter writer =
			context.getResponseWriter();
		writer.startElement("div", this);

        //atts
        writer.writeAttribute("align", align, "align");
        addBaseAttributes(writer);

        String value = super.getValue();
        if (value != null)
            writer.write(super.getValue());

        writer.flush();
	}

    @Override
    public void encodeEnd(FacesContext context)
            throws IOException {
        if (!displayPlataform())
            return;
        ResponseWriter writer = context.getResponseWriter();
        writer.endElement("div");
        writer.flush();
//        return;
    }

    @Override
    public void decode(FacesContext context) {
    }


    // <editor-fold defaultstate="collapsed" desc="Getters and Setters">
    public String getAlign() {
        return align;
    }

    public void setAlign(String align) {
        this.align = align;
    }
    // </editor-fold>

}
